﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Parser
{
    /// <summary>
    /// Delivers functions to identify the site content and type
    /// </summary>
    /// 
    /// <author>Alexander Seeliger </author>
    public class SiteType
    {
        /// <summary>
        /// Site type
        /// </summary>
        public enum SiteTypeEnum
        {
            Content = 0,
            Other = 1
        }

        /// <summary>
        /// Returns the type of the given site
        /// </summary>
        /// <param name="site">Url to the site</param>
        /// <returns>Returns a SiteTypeEnum</returns>
        public static SiteTypeEnum getSiteType(string site)
        {
            string[] split = site.Split('.');
            string extension = split[split.Length - 1];

            switch (extension)
            {
                case "htm":
                case "html":
                case "aspx":
                case "asp":
                case "php":
                case "php3":
                case "php4":
                case "cgi":
                    return SiteTypeEnum.Content;

                default:
                    return SiteTypeEnum.Other;
            }
        }
    }
}
